#!/bin/sh

PATH=/sbin:/bin:/usr/bin:/usr/sbin:%OPTWARE_TARGET_PREFIX%/bin:%OPTWARE_TARGET_PREFIX%/sbin

if grep -q ^sane-port /etc/services; then
	echo
	echo -n "Removing sane-port from /etc/services..."
	sed -i -e "/^sane-port/d" /etc/services
	echo "done."
fi

if [ -f %OPTWARE_TARGET_PREFIX%/etc/inetd.conf ]; then
	if grep -q ^sane-port %OPTWARE_TARGET_PREFIX%/etc/inetd.conf; then
		sed -i -e "/^sane-port/d" %OPTWARE_TARGET_PREFIX%/etc/inetd.conf
		echo
		echo "%OPTWARE_TARGET_PREFIX%/etc/inetd.conf has been updated to remove saned"
		echo "Please restart inetd."
	fi
fi

if [ -f %OPTWARE_TARGET_PREFIX%/etc/xinet.d/saned ]; then
	rm -f %OPTWARE_TARGET_PREFIX%/etc/xinet.d/saned
	echo
	echo "xinetd has been updated to remove saned"
	echo "Please restart xinetd."
fi

